<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head lang="en" th:replace="include/common/common :: commonHeader">
    <footer th:include="include/common/common :: layUiResource"></footer>
    <footer th:include="include/common/common :: blueCSSResource"></footer>
    <footer th:include="include/common/common :: zTreeCSSSource"></footer>
    <footer th:include="include/common/common :: zTreeJSSource"></footer>
    <script>
        layui.config({
            base: '/staticResource/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index','form'] , function () {
            var admin = layui.admin
                ,element = layui.element
                ,form = layui.form;

            element.render();

            let entityName = 'clsItem';
            $(document).ready(function(){
                $.fn.blueJs.tools.formButtonItem(entityName);
            });

            $(document).on('click','.zTreeBtn' , function () {
                $("#zTreeOption").val($(this).attr('data'));
                let elementId = $(this).attr('id') , data = JSON.parse($(this).attr('data')) , i = '/a/layTips/treeSelectForm?isUpdateTree=true' , t = data.title;

                $.fn.blueJs.tools.active['layerOpen'].call(this , i , t);
            });

            form.on('submit(clsItemSave)',function () {
                let msg = $.fn.blueJs.tools.formSubmit(this)
                    ,type = 'saveMsg';
                //当你在iframe页面关闭自身时
                let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                $.fn.blueJs.tools.active[type].call(this , msg , index);
                return false;
            });

            //点击事件监听
            $(document).on('click' , function (event) {
                let targetId = event.target.id;
                let cancelBtn = entityName + "CancelBtn";
                if (targetId == cancelBtn){
                    let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
            });
        });


    </script>
</head>
<body>
<!--  zTree遮罩层 -->
<input type="hidden" id="zTreeOption" value=""/>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form" id="clsItemForm" th:object="${clsItem}" method="post" action="/a/clsItem/save">
                        <!--<div class="box-body">-->
                        <div class="blue-form-unit">基本信息</div>
                        <input type="hidden" name="id" id="clsItemId" th:field="*{id}"/>
                        <input type="hidden" name="isNewRecord" th:field="*{isNewRecord}"/>

                        <div class="layui-form-item">
                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required hide">*</span>上级品类：</label>
                                <thl:tml type="treeSelect" excludeCode="clsItemId" isShowCode="1" title = "上级品类信息"
                                         objectType = "clsItem" objectUrl = "/a/organization/getOrganization" objectEl = "organization"
                                         url = "/a/clsItem/treeDataToForm" name = "parent.id" id = "parent" submitValue = "*{parent.id}" showValue = "*{parent.treeName}"
                                         canSelectRoot = "true" canSelectParent = "true"/>
                            </div>

                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required hide">*</span>排序序号：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" lay-verify="" id="treeSort" th:field="*{treeSort}">
                                </div>
                            </div>

                        </div>

                        <div class="layui-form-item">
                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required ">*</span>品类代码：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" lay-verify="required" placeholder="请输入品类代码" id="treeCode" th:field="*{treeCode}"  >
                                </div>
                            </div>

                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required ">*</span>品类名称：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" lay-verify="required" placeholder="请输入品类名称" id="treeName" th:field="*{treeName}"
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-col-md12">
                                <label class="layui-form-label " title=""><span class="blue-required hide">*</span>备注：</label>
                                <div class="layui-input-block">
                                    <textarea name="remarks" rows="4" maxlength="500" class="layui-textarea" th:text="*{remarks}"></textarea>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-layout-admin">
                            <div class="layui-input-block blue-form-button-item"></div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
</html>

